package server;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class NovelReaderServer {
    public static void main(String[] args) {
        ExecutorService es = Executors.newFixedThreadPool(50);
        ServerSocket serverSocket = null;
        try {
            serverSocket = new ServerSocket(9090);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        System.out.println("server start.....");
        while (true) {
            Socket client = null;
            try {
                client = serverSocket.accept();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            System.out.println(client + "已经连接");
            ServerThread newthread = new ServerThread(client);
            es.submit(newthread);


        }
    }
}
